// TestCore.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <conio.h>
#include <vector>

#include "InputWaveFile.h"
#include "HashPoint.h"


int _tmain(int argc, _TCHAR* argv[])
{
	int sizeofOriginal, sizeofRecording;
	char * filename = "D:\\wav\\Chuyen Mua - Trung Quan Idol.wav";
	INPUT_WAVE test_file = INPUT_WAVE(filename);
	Dictionary HighestSpect = test_file.compute_Spectrogram();
	HashPoint* dataHashPointsOriginal = HashPoint::getGrHash3Point(HighestSpect, &sizeofOriginal);

	printf("Done for the song!\n");
	
	filename = "D:\\wav\\Output.wav";
	test_file = INPUT_WAVE(filename);
	HighestSpect = test_file.compute_Spectrogram();
	HashPoint* dataHashPointsRecording = HashPoint::getGrHash3Point(HighestSpect, &sizeofRecording);

	std::vector<Match> listMatches;
	listMatches = HashPoint::getMatchHashPoint(dataHashPointsOriginal, sizeofOriginal, dataHashPointsRecording, sizeofRecording);

	double MatchingNumber;
	std::vector<double> MatchingOffset = HashPoint::getMatchingNumbers(listMatches, &MatchingNumber);

	printf("We have done with %lf matches!\n", MatchingNumber);
	getch();
	return 0;
}

